<?php

/**
 * NotificationSettings filter form base class.
 *
 * @package    ecollegeplus
 * @subpackage filter
 * @author     Batanayi Matuku
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseNotificationSettingsFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'can_receive_email'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_reply'               => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_peer_activities'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_news_alerts'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_announcement_alerts' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_event_alerts'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_discussion_updates'  => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_course_updates'      => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_assignment_due'      => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_system_updates'      => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'can_receive_system_maintenance'  => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'user_id'                         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'can_receive_email'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_reply'               => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_peer_activities'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_news_alerts'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_announcement_alerts' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_event_alerts'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_discussion_updates'  => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_course_updates'      => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_assignment_due'      => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_system_updates'      => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'can_receive_system_maintenance'  => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'user_id'                         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('User'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('notification_settings_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'NotificationSettings';
  }

  public function getFields()
  {
    return array(
      'id'                              => 'Number',
      'can_receive_email'               => 'Boolean',
      'can_receive_reply'               => 'Boolean',
      'can_receive_peer_activities'     => 'Boolean',
      'can_receive_news_alerts'         => 'Boolean',
      'can_receive_announcement_alerts' => 'Boolean',
      'can_receive_event_alerts'        => 'Boolean',
      'can_receive_discussion_updates'  => 'Boolean',
      'can_receive_course_updates'      => 'Boolean',
      'can_receive_assignment_due'      => 'Boolean',
      'can_receive_system_updates'      => 'Boolean',
      'can_receive_system_maintenance'  => 'Boolean',
      'user_id'                         => 'ForeignKey',
    );
  }
}
